﻿using System;
using fastCSharp;

namespace diantou.web.answer
{
    /// <summary>
    /// 相关收藏
    /// </summary>
    [fastCSharp.code.cSharp.webView(IsPool = true, IsReferer = false)]
    partial class favorite : view<favorite>
    {
        /// <summary>
        /// 收藏集合
        /// </summary>
        [fastCSharp.emit.webView.clearMember]
        private diantou.web.favorite.userFavorite[] favorites;
        /// <summary>
        /// 话题首页
        /// </summary>
        /// <param name="answerId">问题标识</param>
        /// <param name="page">分页号</param>
        /// <returns>是否成功</returns>
        private bool loadView(int answerId, int page)
        {
            if (base.load(answerId))
            {
                diantou.dataAccess.favorite[] values = diantou.dataAccess.clientCache.Favorite.Get(diantou.dataAccess.tcpCall.favorite.relateIds(dataModel.favorite.type.Answer, answerId, pageInfo.Size = fastCSharp.config.pub.Default.PageSize, pageInfo.Page = page, currentUserId, out pageInfo.Count));
                favorites = values.getArray(value => new diantou.web.favorite.userFavorite { Favorite = value, UserId = currentUserId });
                if (requestHeader.IsSearchEngine) pageInfo.Path = answer.Path.Favorite.ToPageString();
                return true;
            }
            return false;
        }
    }
}
